Lazy Wheel Sieves and Spirals of Primes

نویسنده

  • Colin Runciman
چکیده

The popular method of enumerating the primes is the Sieve of Eratosthenes. It can be programmed very neatly in a lazy functional language, but runs rather slowly. A little-known alternative method is the Wheel Sieve, originally formulated as a fast imperative algorithm for obtaining all primes up to a given limit, assuming destructive access to a bit-array. This article describes functional variants of the wheel sieve that enumerate all primes as a lazy list.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Trading Time for Space in Prime Number Sieves

A prime number sieve is an algorithm that nds the primes up to a bound n. We present four new prime number sieves. Each of these sieves gives new space complexity bounds for certain ranges of running times. In particular, we give a linear time sieve that uses only O(p n=(log log n) 2) bits of space, an O l (n= log log n) time sieve that uses O(n=((log n) l log log n)) bits of space, where l > 1...

متن کامل

Ramanujan and Labos Primes, Their Generalizations, and Classifications of Primes

We study the parallel properties of the Ramanujan primes and a symmetric counterpart, the Labos primes. Further, we study all primes with these properties (generalized Ramanujan and Labos primes) and construct two kinds of sieves for them. Finally, we give a further natural generalization of these constructions and pose some conjectures and open problems.

متن کامل

The Pseudosquares Prime Sieve

We present the pseudosquares prime sieve, which finds all primes up to n. Define p to be the smallest prime such that the pseudosquare Lp > n/(π(p)(logn)); here π(x) is the prime counting function. Our algorithm requires only O(π(p)n) arithmetic operations and O(π(p) log n) space. It uses the pseudosquares primality test of Lukes, Patterson, and Williams. Under the assumption of the Extended Ri...

متن کامل

On the Small Sieve . I . Sifting by Primes

The main object of the paper is to prove that if P is a set of primes with sum of reciprocals _cx, where c is a positive constant depending only on K. A lower estimate is given for c and a similar result is achieved in the case when the condition of primality is substituted by the weaker condition that any m elem...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • J. Funct. Program.

دوره 7  شماره 

صفحات  -

تاریخ انتشار 1997